#!/usr/bin/env python
# -*- coding:utf-8 -*-
# import os
# import sys
#
# Base_dir=os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# sys.path.append(Base_dir)

from Mythreadpool import Pool
import time
def Foo(i):
    time.sleep(3)
    print "thread :",i
    return "thread %s release."%i

def Bar(arg):
    print arg

if __name__ == '__main__':
    pool=Pool(raw_input("How much thread do you want create in pool:"))
    for i in range(1,raw_input("")):
        pool.apply_async(func=Foo,args(i,),callback=Bar)